package com.wj.algorithm.lintcode;

public class P142 {
    public boolean checkPowerOf2(int n) {
        if(n <= 0) {
            return false;
        }
        if(n == 1) {
            return true;
        }
        String s = Integer.toBinaryString(n);
        int len = s.length();
        
        return n == 2 << (len - 2);
    }
    
    public static void main(String[] args) {
        P142 p = new P142();
        System.out.println(p.checkPowerOf2(524288));
    }
}
